package com.bamanker.cloudapi.model.response;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;

/**
 * 接口返回结果，不带对象的
 * @author bamanker
 */

@Data
@NoArgsConstructor
public class BaseResponse implements Serializable {

    @Serial
    private static final long serialVersionUID = -7671756385477179547L;

    /**
     * api返回码
     */

    protected Integer code ;
    /**
     * api返回消息
     */

    protected String msg ;

    /**
     * 服务器时间
     */

    protected long timestamp = System.currentTimeMillis();


    protected Boolean success ;


    public BaseResponse(Integer code,String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseResponse(Integer code,String msg,Boolean success) {
        this.code = code;
        this.msg = msg;
        this.success=success;
    }

    public BaseResponse(String msg) {
        this.msg = msg;
    }

    /**
     * 是否成功
     */

    public boolean isSuccess() {
        return this.success;
    }

}
